package Job

import org.apache.spark.SparkContext
import org.apache.spark.rdd.RDD

object MovieIndustrySalTop {
  def main(args: Array[String]): Unit = {
    val sc: SparkContext = new SparkContext("local[*]", "MovieIndustrySalTop")
    val inputPath: String = "file/JobData/input"
    val outputPath: String = "file/JobData/output/MovieIndustrySalTop"

    val InfoLine: RDD[String] = sc.textFile(inputPath)
      .filter(x => x.split(",")(17)=="影视文娱")
      .repartition(2)

    val res = InfoLine.map(x =>{
      (x.split(",")(2),x.split(",")(0),x.split(",")(11).toInt)
    }).sortBy(_._2,ascending = false)
      .take(5)

    res.foreach(println)
    sc.stop()
  }

}
